package com.isunland.managesystem.adapter;

import android.content.Context;
import android.text.TextUtils;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BaseShadowListAdapter;
import com.isunland.managesystem.entity.StockMaterial;
import com.isunland.managesystem.utils.MyStringUtil;
import java.util.List;

/**
 * 对象功能:
 * 开发公司: 北京信普达系统工程有限公司
 * 开发人员: HuXiaoDan
 * 创建时间: 2017/6/28 14:17
 */
public class StockMaterialAdapter extends BaseShadowListAdapter<StockMaterial> {
  public StockMaterialAdapter(Context context, List<StockMaterial> objects) {
    super(context, objects);
  }

  @Override public void bindData(int position, ViewHolder vh, StockMaterial item) {

    vh.mContentOneTv.setText(
        MyStringUtil.connect(item.getMaterialName(), "(", item.getMaterialSelfCode(), ")  —",
            item.getMtype()));
    vh.mContentOneTv.setTextColor(getContext().getResources().getColor(R.color.chocolate));
    vh.mContentStatusTv.setText(item.getStoragePlaceName());//仓库
    vh.mContentTwoTv.setText(item.getMaterialKindName());//物料类别
    if (!TextUtils.isEmpty(item.getMfactoryName())) {
      vh.mContentThreeTv.setText(item.getMfactoryName());//生产厂家
    }
    vh.mTypeTv.setText(MyStringUtil.connect("现存：", item.getCount(), item.getMunit()));
    vh.mPersonDataTv.setText(MyStringUtil.connect("待出：", item.getUnoutNum(), item.getMunit()));
    vh.mPersonNameTv.setText(MyStringUtil.connect("待入：", item.getUninNum(), item.getMunit()));
  }
}
